'''
  EJERCICIO
'''

# Incorrecto

class Bird:
  def fly(self):
    return "Flying"
  

class Chicken(Bird):
  def fly(self):
    raise Exception("Los pollos no vuelan")
  
# bird = Bird()
# bird.fly()
# chicken = Chicken()
# chicken.fly()

# Correcto

class Bird:
  def move(self):
    return "Moving"
  
class Chicken(Bird):
  def move(self):
    return "Walking"

class Crow(Bird):
  def move(self):
    return "Flying"
  
bird = Bird()
print(bird.move())
chicken = Chicken()
print(chicken.move())
crow = Crow()
print(crow.move())

bird = Chicken()
print(bird.move())
chicken = Crow()
print(chicken.move())
crow = Bird()
print(bird.move())

'''
  EXTRA
'''

class Vehicle:
  def __init__(self, speed = 0):
    self.speed = speed

  def accelerate(self, increment):
    self.speed += increment
    print(f'Velocidad: {self.speed} Km/h')

  def brake(self, decrement):
    self.speed -= decrement
    if self.speed <= 0:
      self.speed = 0
    print(f'Velocidad: {self.speed} Km/h')

class Car(Vehicle):
  def accelerate(self, increment):
    print("El coche está acelerando")
    super().accelerate(increment)

  def brake(self, decrement):
    print("El coche está frenando")
    super().brake(decrement)


class Bicycle(Vehicle):
  def accelerate(self, increment):
    print("La bicicleta está acelerando")
    super().accelerate(increment)
  
  def brake(self, decrement):
    print("La bicicleta está frenando")
    super().brake(decrement)

class Motorcycle(Vehicle):
  def accelerate(self, increment):
    print("La motocicleta está acelerando")
    super().accelerate(increment)
  
  def brake(self, decrement):
    print("La motocicleta está frenando")
    super().brake(decrement)

def test_vehicle(vehicle):
  vehicle.accelerate(2)
  vehicle.brake(1)

car = Car()
bicycle = Bicycle()
motorcycle = Motorcycle()

test_vehicle(car)
test_vehicle(bicycle)
test_vehicle(motorcycle)